var AppConfig = function(){
	
	this.refresh = function(){
		var pid = $("input[name=J_Selector]:checked").val();
		if(pid == null || pid == undefined || (!pid) ){
			alert("参数错误.");
			return false;
		}
		
        var paras = "pid="+pid;
		$.ajax({
			type    : "POST",
			url     : "refreshExec.do",
			data    : paras,
			dataType: "json",
			success : function(rs){
				alert(rs.message);
			}
		});
		
	}
	
	this.rebuild = function(){
		var pid = $("input[name=J_Selector]:checked").val();
		if(pid == null || pid == undefined || (!pid) ){
			alert("参数错误.");
			return false;
		}
		
        var paras = "pid="+pid;
		$.ajax({
			type    : "POST",
			url     : "rebuild.do",
			data    : paras,
			dataType: "json",
			success : function(rs){
				alert(rs.message);
			}
		});
	}
	
	this.update = function(){
		var pid = $("input[name=J_Selector]:checked").val();
		if(pid == null || pid == undefined || (!pid) ){
			alert("参数错误.");
			return false;
		}
		
		window.open("config/updateAppConfig.htm?id="+pid,'New Window.',"fullscreen=1");
	}
	
	this.remove = function(){
		var pid = $("input[name=J_Selector]:checked").val();
		if(pid == null || pid == undefined || (!pid) ){
			alert("参数错误.");
			return false;
		}
		
        var paras = "pid="+pid;
		$.ajax({
			type    : "POST",
			url     : "removeApp.do",
			data    : paras,
			dataType: "json",
			success : function(rs){
				alert(rs.message);
				location.reload();
			}
		});
	}
	
	this.initSystem = function(type){
		if(type == null || type == undefined || (!type) ){
			alert("参数错误.");
			return false;
		}
        var paras = "type="+type;
		$.ajax({
			type    : "POST",
			url     : "initSystem.do",
			data    : paras,
			dataType: "json",
			success : function(rs){
				alert(rs.message);
				location.reload();
			}
		});
	}
}

var _appConfig = new AppConfig();